﻿using System;
using System.Collections.Generic;
using System.Runtime.Serialization;

using SBPweb.RIA.Shared.Contracts.Extensibility;

namespace SBPweb.RIA.Client.Contracts.Base
{

    [CollectionDataContract]
    public class ExtendableBag : ExtendableBase
    {

        #region Constructor logic

        public ExtendableBag()
            : base()
        {
        }

        public ExtendableBag(ExtendableBase extendable)
            : base()
        {
        }

        protected ExtendableBag(IEnumerable<KeyValuePair<string, object>> keyValues)
            : base()
        {
            foreach (KeyValuePair<string, object> kvp in keyValues)
            {
                Add(kvp);
            }
        }

        #endregion

        #region Methods

        //public void Add(object obj)
        //{
        //    Add((KeyValuePair<string, object>)obj);
        //}

        public void Add(KeyValuePair<string, object> kvp)
        {
            Put<object>(kvp.Key, kvp.Value);
        }

        #endregion

    //    private Dictionary<string, object> dict = new Dictionary<string, object>();

    //    #region IExtendable Members

    //    public T Get<T>(string propertyName)
    //    {
    //        return (T)dict[propertyName];
    //    }

    //    public void Put<T>(string propertyName, T value)
    //    {
    //        dict[propertyName] = value;
    //    }

    //    #endregion

    }

}
